/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.google.code.jmarias.server;
import java.util.*;
import com.google.code.jmarias.common.*;

/**
 * trida reprezentujici samotneho hrace, nad niz je klient grafickou nadstavbou
 * @author josef
 */
public class Player {
    private int index;
    private String name;
    private Set<Card> hand;
    private List<Card> wonCards;
    private static Suit trumphs;

    public Player(int index, String name) {
        this.index = index;
        this.name = name;
        CardComparator comparer = new CardComparator();
        this.hand = new TreeSet<Card>(comparer);
        this.wonCards = new LinkedList<Card>();
    }

    public void takeCards(Set<Card> cards) {
        hand.addAll(cards);
    }

    public void removeCards(List<Card> cards) {
        hand.removeAll(cards);
    }

    public Set<Card> getHand() {
        return hand;
    }

    public int getIndex() {
        return index;
    }

    public String getName() {
        return name;
    }

    public List<Card> getWonCards() {
        return wonCards;
    }

    public static Suit getTrumphs() {
        return trumphs;
    }

    public void addCardsToHand(Card[] cards) {
        for (Card card : cards) {
            hand.add(card);
        }
    }

    
}
